//
//  WQComposeButton.swift
//  WeiBo
//
//  Created by 张德华 on 7/28/16.
//  Copyright © 2016 ZhangDeHua. All rights reserved.
//

import UIKit

class WQComposeButton: UIButton {

    /**模型*/
    var composeButtonInfo: WQComposeButtonInfo?
    
    /**去掉按钮高亮效果*/
    override var highlighted: Bool{
        get {
            return false
        }
        
        set {
            
        }
    }
    
    // MARK: - ************init
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: - ************设置视图
    func setupUI() {
        
        ///------ 设置imageView
        imageView?.contentMode = .Center
        
        ///------ 设置title
        titleLabel?.textAlignment = .Center
        titleLabel?.font = UIFont.systemFontOfSize(15)
        setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
    }
    
    
    // MARK: - ************对按钮中的子控件重新布局
    override func layoutSubviews() {
        super.layoutSubviews()
        
        ///------ 设置imageView
        imageView?.frame = CGRect(x: 0, y: 0, width: self.frame.width, height: self.frame.width)
        
        ///------ 设置title
        titleLabel?.frame = CGRect(x: 0, y: self.frame.width, width: self.frame.width, height: self.frame.height - self.frame.width)
        
        
        
    }
    
    
    
    
    
    
    
    
    
    
    
    

}
